<?php

/**
 * 
 * These are are-bones views for showing system messages.
 *
 */

require_once 'util.php';

class SystemView {
	
	private $content;
	
	public function __construct($content) {
		$this->content = $content;
	}
	
	public function send() {
		echo "<h1>ActionFramework system message</h1>";
		if (ends_with($this->content, '.php')) {
			$view = $this;
			require $this->content;
		}
		else {
			echo $this->content;
		}
	}
	
}

class AbstractRequestRejectedView extends SystemView {
	
	public $report;
	
	public function __construct($template, $report) {
		parent::__construct($template);
		$this->report = $report;
	}
}

class RequestInsufficientView extends AbstractRequestRejectedView {
	
	public $unavailable;
	
	public function __construct($unavailable, $report) {
		parent::__construct("RequestInsufficient.php", $report);
		$this->unavailable = $unavailable;
	}
	
}

class RequestInvalidView extends AbstractRequestRejectedView {
	
	public $comment;
	
	public function __construct($comment, $report) {
		parent::__construct("RequestInvalid.php", $report);
		$this->comment = $comment;
	}
	
}

class TextView {
	
	private $content;
	
	public function __construct($content) {
		$this->content = $content;
	}
	
	public function send() {
		echo $this->content;
	}
	
}
?>